<?php
/**
* 前端入口
**/
header("content-type:text/html;charset=utf-8");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers:jwtToken");
//error_reporting(E_ALL);
//ini_set('display_errors','On');
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

defined('BASE_PATH') or define('BASE_PATH', dirname(__DIR__));
defined('VENDOR_PATH') or define('VENDOR_PATH', BASE_PATH . '/vendor');


require BASE_PATH . '/heihei/bootstrap.php';


$projectCode = heihei\web\ProjectRoute::resolveRequestRoute();
if(empty($projectCode)){
    die('项目不能为空!');
}

defined('APP_BASE_PATH') or define('APP_BASE_PATH', BASE_PATH . '/apps/' . $projectCode);
require BASE_PATH . '/config/bootstrap.php';

$config = yii\helpers\ArrayHelper::merge(
    require BASE_PATH . '/config/main.php',
    require BASE_PATH . '/config/main-local.php',
    require APP_BASE_PATH . '/config/main.php',
    require APP_BASE_PATH . '/config/main-local.php'
);

(new heihei\web\Application($config))->run();